<?php
class ControllerReportSearchKeyword extends AdminController {

	public function index() {
		M('report/search_keyword', 'mod_sk');
		$this->getList();
	}

	public function delete() {
		M('report/search_keyword', 'mod_sk');
		if ($this->request->post['selected']) {
			$this->mod_sk->deleteKeyword($this->request->post['selected']);
			$this->session->set_flashdata('success', $this->_['text_success']);
			$this->redirect(UA('report/search_keyword', 'filter_reset=1'));
		}
		$this->getList();
	}

	protected function getList() {
		$this->document->setTitle($this->_['heading_title']);

		$qf = new Query_filter();
		$total = $this->mod_sk->getTotalKeywords($qf);
		$this->data['keywords'] = $this->mod_sk->getKeywords($qf);
		$this->data['pagination'] = $this->pagination($total)->render();
	
		$this->display('report/search_keyword_list.tpl');
	}
}